home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Add-Ons / HyperCard / CurrentTime XFCN 1.0.0 / CurrentTime.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-07  |  1.6 KB  |  66 lines  |  [TEXT/CWIE]

  1. /* ----------------------------------------------------------------------
  2.  
  3.     CurrentTime XFCN
  4.     version 1.0.0
  5.     
  6.     Written by: Paul Celestin
  7.     
  8.     Copyright © 1996 Celestin Company, Inc.
  9.     
  10.     This XFCN returns the current time, using the format set in the
  11.     Date & Time control panel.
  12.     
  13.     No parameters required!
  14.     
  15.     960707 - 1.0.0 - initial release
  16.  
  17. ---------------------------------------------------------------------- */
  18.  
  19. #include <A4Stuff.h>
  20. #include <HyperXCmd.h>
  21.  
  22. #define PARAMETER_NUMS        0
  23. #define PARAMETER_TEXT        "\pNo parameters required!"
  24.  
  25.  
  26. /* ----------------------------------------------------------------------
  27. prototypes
  28. ---------------------------------------------------------------------- */
  29. void DoIt(XCmdPtr paramPtr);
  30. char LookUp[256];
  31.  
  32.  
  33. /* ----------------------------------------------------------------------
  34. main
  35. ---------------------------------------------------------------------- */
  36. pascal void main(XCmdPtr paramPtr)
  37. {
  38.     Str255 copyright = "\pCopyright © 1996 Celestin Company, Inc.";
  39.     long oldA4 = SetCurrentA4();
  40.     if (paramPtr->paramCount != PARAMETER_NUMS)
  41.     {
  42.         paramPtr->returnValue =
  43.             PasToZero(paramPtr,PARAMETER_TEXT);
  44.     }
  45.     else
  46.     {
  47.         DoIt( paramPtr );
  48.     }
  49.     SetA4(oldA4);
  50. }
  51.  
  52. /* ----------------------------------------------------------------------
  53. DoIt
  54. ---------------------------------------------------------------------- */
  55. void DoIt(XCmdPtr paramPtr)
  56. {
  57.     unsigned long    rawTime;
  58.     Str255            timeString;
  59.     Handle            iOh = GetIntlResource(0);
  60.  
  61.     GetDateTime(&rawTime);
  62.         IUTimePString(rawTime,FALSE,timeString,(Handle)iOh);
  63.  
  64.     paramPtr->returnValue = PasToZero(paramPtr,timeString);
  65. }
  66.